package com.tchhy.provider.data.healthy.response

import com.chad.library.adapter.base.entity.MultiItemEntity
import java.util.*

/**
 * author：Jake
 * date：2017/12/8
 */
class IndexImage : MultiItemEntity {
    private var localType = TYPE_IMAGE
    var uuid: String? = null
    var imageUrl: String? = null
    var path: String? = null
    var subDomainName: String? = null
    var status = STATUS_UNSTART

    constructor() {
        uuid = UUID.randomUUID().toString()
    }

    constructor(imageUrl: String) {
        this.imageUrl = imageUrl
        uuid = UUID.randomUUID().toString()
    }

    constructor(imageUrl: String, path: String) {
        this.imageUrl = imageUrl
        this.path = path
        uuid = UUID.randomUUID().toString()
    }

    constructor(localType: Int, imageUrl: String) {
        this.localType = localType
        this.imageUrl = imageUrl
        uuid = UUID.randomUUID().toString()
    }

    fun setLocalType(localType: Int) {
        this.localType = localType
    }

    override fun getItemType(): Int {
        return localType
    }

    override fun equals(obj: Any?): Boolean {
        return if (obj != null && obj is IndexImage) {
            uuid == obj.uuid
        } else super.equals(obj)
    }

    companion object {
        val STATUS_UNSTART = "status_unstart"
        val STATUS_UPLOADING = "status_uploading"
        val STATUS_UPLOAD_FAIL = "status_upload_fail"
        val STATUS_UPLOAD_SUCCESS = "status_upload_success"
        val IMAGE_ADD = "image_add"
        val TYPE_IMAGE = 0
        val TYPE_IMAGE_ADD = 1
    }
}
